#include "ODN_NetworkManager.h"

namespace ouden {

CClientManager::CClientManager(String sHostAddress, unsigned short iServerPort, unsigned short iClientPort)
{
	//ctor
	
	m_pClient = RakNetworkFactory::GetRakClientInterface();
	m_pClient->Connect(sHostAddress.c_str(), iServerPort, iClientPort, 0, 0);
	
}

CClientManager::~CClientManager()
{
	//dtor
	
	m_pClient->Disconnect(300);
	RakNetworkFactory::DestroyRakClientInterface(m_pClient);
	
}

CServerManager::CServerManager(unsigned short iMaxPlayers, unsigned short iServerPort)
{
	//ctor
	
	m_pServer = RakNetworkFactory::GetRakServerInterface();
	m_pServer->Start(iMaxPlayers - 1, 0, false, iServerPort);
	
}

CServerManager::~CServerManager()
{
	//dtor
	
	m_pServer->Disconnect(300);
	RakNetworkFactory::DestroyRakServerInterface(m_pServer);
	
}

} //namespace ouden
